export default {
  mounted(el, { value }) {
    let startY = 0
    el.addEventListener('touchstart', e => {
      startY = e.touches[0].pageY
    })
    el.addEventListener('touchmove', e => {
      const currentY = e.touches[0].pageY
      if (currentY - startY > 100 && window.scrollY <= 0) {
        value?.() // 触发下拉刷新回调
      } else if (window.innerHeight + window.scrollY >= document.body.offsetHeight - 50) {
        value?.() // 触底加载更多
      }
    })
  }
}
